package com.qfedu.cardlikelazy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qfedu.cardlikelazy.domain.User;
import com.qfedu.cardlikelazy.mapper.UserMapper;
import com.qfedu.cardlikelazy.response.R;
import com.qfedu.cardlikelazy.response.Response;
import com.qfedu.cardlikelazy.service.UserService;
import com.qfedu.cardlikelazy.utils.StringUtils;

import org.springframework.stereotype.Service;


import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper mapper;
    @Override
    public R login(String username, String password) {
        if (username != null && StringUtils.isNoyEmpty(username, password)){
            User u = mapper.selectOne(new QueryWrapper<User>().eq("username" , username));
            if (u!=null){
                if (u.getPassword().equals(password)){
                    return R.ok("登陆成功");
                }
            }
        }
        return R.fail("账号或者密码错误");
    }

}


